<?php
	if($_POST){
		$title = $_POST['title'];
		$filename = str_replace(' ','_',substr($title,0,8)).'.php';
		$categorie = $_POST['categorie'];
		$fichier = fopen('./newsManager/'.$categorie.'/'.$filename, 'a');
		fputs($fichier,$_POST['textarea']);
		fclose($fichier);

		if($categorie != "News"){
			$newsName = "news_".$filename;
			$newsFile = fopen('./newsManager/News/'.$newsName, 'a');
			fputs($newsFile, $_POST['textarea']);
			fclose($newsFile);
		}

	}
?>